using System.Collections;
using System.Collections.Generic;
using EnvDTE;

namespace Microsoft.WowAddonStudio.Tests.Common.Mocks
{
	/// <summary>
	/// Contains all of the properties of a given object that are contained in a generic collection of properties.
	/// </summary>
    public class MockProperties : Dictionary<object, Property>, Properties
    {
		/// <summary>
		/// Initializes a new instance of the <see cref="MockProperties"/> class.
		/// </summary>
		/// <param name="dte">The DTE.</param>
		/// <param name="projectItem">The project item.</param>
        public MockProperties(DTE dte, ProjectItem projectItem)
        {
            DTE = dte;
            Parent = projectItem;
        }

        #region IEnumerable Members

		/// <summary>
		/// Returns an enumerator that iterates through a collection.
		/// </summary>
		/// <returns>
		/// An <see cref="T:System.Collections.IEnumerator"/> object that can be used to iterate through the collection.
		/// </returns>
        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }

        #endregion

        #region Properties Members

		/// <summary>
		/// Returns an indexed member of a <see cref="T:EnvDTE.Properties"/> collection.
		/// </summary>
		/// <param name="index">Required. The index of the <see cref="T:EnvDTE.Property"/> object to return.</param>
		/// <returns>
		/// A <see cref="T:EnvDTE.Property"/> object.
		/// </returns>
        public Property Item(object index)
        {
            return this[index];
        }

		/// <summary>
		/// Returns an enumerator that iterates through a collection.
		/// </summary>
		/// <returns>
		/// An <see cref="T:System.Collections.IEnumerator"/> object that can be used to iterate through the collection.
		/// </returns>
        IEnumerator Properties.GetEnumerator()
        {
            return GetEnumerator();
        }

		/// <summary>
		/// Microsoft Internal Use Only.
		/// </summary>
		/// <value></value>
		/// <returns/>
        public object Application
        {
            get { return DTE.Application; }
        }

		/// <summary>
		/// Gets the immediate parent object of a <see cref="T:EnvDTE.Properties"/> collection.
		/// </summary>
		/// <value></value>
		/// <returns>An object.</returns>
        public object Parent { get; set; }

		/// <summary>
		/// Gets the top-level extensibility object.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.DTE"/> object.</returns>
        public DTE DTE { get; set; }

        #endregion
    }
}